package com.sljr.mvndemo;

public class AppUtil {
	public static final String ABSTRACT_MAPPER_TESTCASE = "import java.io.IOException;\n"+
		"import java.io.InputStream;\n"+
		"\n"+
		"import junit.framework.TestCase;\n"+
		"\n"+
		"import org.apache.ibatis.io.Resources;\n"+
		"import org.apache.ibatis.session.SqlSession;\n"+
		"import org.apache.ibatis.session.SqlSessionFactory;\n"+
		"import org.apache.ibatis.session.SqlSessionFactoryBuilder;\n"+
		"\n"+
		"public abstract class AbstractMappterTestCase extends TestCase{\n"+
			"\tprivate SqlSession session;\n"+
			"\t{\n"+
			"	\t\ttry {\n"+
			"		\t\t\tString resource = \"mybatis/mybatis-config.xml\";\n"+
			"		\t\t\tInputStream inputStream = Resources.getResourceAsStream(resource);\n"+
			"		\t\t\tSqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);\n"+
			"		\t\t\tsession = sqlSessionFactory.openSession();\n"+
			"	\t\t} catch (IOException e) {\n"+
			"		\t\t\te.printStackTrace();\n"+
			"	\t\t}\n"+
			"\t}\n"+
			"\n"+
			"\tpublic AbstractMappterTestCase() {\n"+
			"	\t\tsuper();\n"+
			"\t}\n"+
			"\n"+
			"\tpublic SqlSession getSqlSession() {\n"+
			"	\t\treturn session;\n"+
			"\t}\n"+
			"\n"+
			"\tpublic void testDummy() {"+
			"	\t\tSystem.out.println(getSqlSession());\n"+
			"\t}"+
		"}";
	
	public static final String JDBC_PROPERTIES = ""
			+ "jdbc.driver=oracle.jdbc.driver.OracleDriver\n"
			+ "jdbc.url=jdbc:oracle:thin:@192.16.150.202:1521:sldb\n"
			+ "jdbc.username=wealth\n"
			+ "jdbc.password=wealth\n";
	
	public static final String MYBATIS_CONFIG = ""
			+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
			+ "<!DOCTYPE configuration"
			+ "  PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n"
			+ "  \"http://mybatis.org/dtd/mybatis-3-config.dtd\">\n"
			+ "<configuration>\n"
			+ "	<properties resource=\"jdbc.properties\">\n"
			+ "		<property name=\"dialect\" value=\"ORACLE\" />\n"
			+ "	</properties>\n"
			+ "	<environments default=\"development\">\n"
			+ "		<environment id=\"development\">\n"
			+ "			<transactionManager type=\"JDBC\" />\n"
			+ "			<dataSource type=\"POOLED\">\n"
			+ "				<property name=\"driver\" value=\"${jdbc.driver}\" />\n"
			+ "				<property name=\"url\" value=\"${jdbc.url}\" />\n"
			+ "				<property name=\"username\" value=\"${jdbc.username}\" />\n"
			+ "				<property name=\"password\" value=\"${jdbc.password}\" />\n"
			+ "			</dataSource>\n"
			+ "		</environment>\n"
			+ "	</environments>\n"
			+ "	<mappers>\n"
			+ "		<mapper resource=\"mybatis/sqlMap/base/*Mapper.xml\" />\n"
			+ "	</mappers>\n"
			+ "</configuration>\n";
}
